#include "controlMessageDialog.h"

controlMessageDialog::controlMessageDialog()
{
	//this->setFixedSize(320, 240);
	QVBoxLayout *vLayout = new QVBoxLayout(this);
	QHBoxLayout *layout = new QHBoxLayout();

	contentLabel = new QLabel();
	contentLabel->setWordWrap(true);
	vLayout->addWidget(contentLabel);
	vLayout->addLayout(layout);

	QPushButton *buttonDel = new QPushButton();
	buttonDel->setText(cntr("删除"));
	QPushButton *buttonMove = new QPushButton();
	buttonMove->setText(cntr("移动"));
	QPushButton *buttonCancel = new QPushButton();
	buttonCancel->setText(cntr("取消"));
	layout->addWidget(buttonDel);
	layout->addWidget(buttonMove);
	layout->addWidget(buttonCancel);
	result = -1;
	connect(buttonDel,SIGNAL(clicked()),this,SLOT(slotDel()));
	connect(buttonMove,SIGNAL(clicked()),this,SLOT(slotMove()));
	connect(buttonCancel,SIGNAL(clicked()),this,SLOT(slotCancel()));
}

void controlMessageDialog::slotDel()
{
	int ans = QMessageBox::warning(NULL, cntr("注意"), cntr("确认删除短信?"), cntr("是"), cntr("否"));
	if(ans == 1)
	{
		return;
	}else{
		result = 0;
		accept();
	}
}

void controlMessageDialog::slotMove()
{
	result = 1;
	accept();
}

void controlMessageDialog::slotCancel()
{
	reject();
}
